////
//  EFSChartSocketManager.m
//  EFSMobile
//
//  Created by Chuan on 11/18/15.
//  Copyright © 2015 Elephants Financial Service. All rights reserved.
//

#import "EFSChartSocketManager.h"
//#import "EFSAppInfo.h"
//#import "NSUserDefaults+EFS.h"
#import "ChartSocketController+Observe.h"

#import "ChartSocketLogger.h"

#import <YTXRequest/YTXRequest.h>
static ChartSocketController * sharedController;
static dispatch_once_t token;
@implementation EFSChartSocketManager

+ (ChartSocketController *) sharedChartSocketController
{

    dispatch_once(&token, ^{
        sharedController = [[ChartSocketController alloc] init];
        
        [sharedController observeConnect];
        
        [[[[NSNotificationCenter defaultCenter] rac_addObserverForName:UIApplicationWillEnterForegroundNotification object:nil] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
            [sharedController reconnect];
        }];
    });
    return sharedController;
}
+ (void)tearDown{
    
    [sharedController reconnect];
}

@end
